Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(v2): remove Markdown syntax from excerpt #2701

Merged
merged 4 commits into from
May 18, 2020
Merged

Conversation

lex111
Copy link
Contributor

@lex111 lex111 commented Apr 30, 2020

Motivation

Resolve #2607

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

See preview and tests.

Related PRs

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)

@lex111 lex111 added the pr: bug fix This PR fixes a bug in a past release. label Apr 30, 2020
@lex111 lex111 requested a review from yangshun as a code owner April 30, 2020 12:42
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Apr 30, 2020
@docusaurus-bot
Copy link
Contributor

docusaurus-bot commented Apr 30, 2020

Deploy preview for docusaurus-2 ready!

Built with commit 3ec542d

https://deploy-preview-2701--docusaurus-2.netlify.app

Copy link
Contributor

@yangshun yangshun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Have you considered using https://github.com/remarkjs/strip-markdown instead? It's based on remark while remove-markdown uses regex.

@lex111
Copy link
Contributor Author

lex111 commented Apr 30, 2020

Ok, I used Remark for these purposes, but I noticed that there was a slight decrease in performance compared to the previous solution that uses regular expressions. I commented lines related to the previous solution so that you can see for yourself which option is better.

UPD: Moreover, we do not need to use a third-party "remove-markdown" package as ready-made solution that removes MD via regular expressions, since there are many replace calls that are not needed in our case.
We can take a limited number of these regexps and thus improve performance. WDYT?

image

Copy link
Contributor

@yangshun yangshun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should allow the full syntax to also handle cases like this:

Screen Shot 2020-05-13 at 11 04 49 AM

@lex111
Copy link
Contributor Author

lex111 commented May 13, 2020

I did not understand which of the solutions we use in the end?

@lex111
Copy link
Contributor Author

lex111 commented May 17, 2020

cc @yangshun

@yangshun yangshun added this to the v2.0.0-alpha.55 milestone May 17, 2020
Copy link
Contributor

@yangshun yangshun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which do you recommend?

@lex111
Copy link
Contributor Author

lex111 commented May 17, 2020

Personally, I like a solution using regular expressions. We can opt out of using the npm strip-markdown package, and instead choose the regexps we really need to solve current issue.

@yangshun
Copy link
Contributor

Ok let's do your way then. Introducing a perf regression for this isn't really worth it.

@lex111
Copy link
Contributor Author

lex111 commented May 17, 2020

Done ✔️

Time building on my laptop:
Before 54.65s
After 55.22s.

Probably not bad, although I think we need a more accurate way to comparing than just starting the building website with a cleared cache.

@yangshun yangshun merged commit da0f865 into master May 18, 2020
@yangshun yangshun deleted the lex111/strip-markdown branch May 18, 2020 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Meta description not formatting/removing markdown
4 participants